/************************************************************************
 * 项目名称（软件名称）：忠旺机械物资管理系统(mms)                           *
 * 研发设计单位：忠旺机械设备制造有限公司机械设计院智能控制设计科设计与研发。   *
 * 版权所有：忠旺机械设备制造有限公司                                       *
 * 注：本项目的一切技术专利，使用规范归解释权由忠旺机械设备制造有限公司所有。   *
 * 软件版本：Ver 1.0.0                                                   *
 * 文件路径：com.zhongwang.mms.module.buy.dao                            *
 * 创建时间：2020年08月11日 18时07分                                      *
 *======================================================================*/
package com.zhongwang.mms.module.buy.dao;

import com.zhongwang.mms.gen.entity.*;
import com.zhongwang.mms.module.buy.model.ChangeDataModel;
import com.zhongwang.mms.module.buy.model.ShopPlanChangeReceiveModel;
import org.apache.ibatis.annotations.Param;
import org.omg.CORBA.PUBLIC_MEMBER;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
/**
 *@name: ChangeDao
 *@description:  采购变更管理持久层
 *@author: 徐一贺
 *@coddingDate: 2020/8/11 18:08
 *@version: v1.0
**/
public interface ChangeDao {
    /**
     *@name: receiveList
     *@description: 获取变更接收列表
     *@param: [param] 检索参数
     *@returnType: com.zhongwang.mms.common.JsonResult
     *@author: 徐一贺
     *@coddingDate: 2020/8/11 19:54
     *@version: v1.0
     **/
    List<ShopPlanChangeReceiveModel> receiveList(ShopPlanChangeReceiveModel param);

    /**
     *@name: planList
     *@description: 获取接收变更计划列表
     *@param: [param]
     *@returnType: java.util.List<com.zhongwang.mms.module.buy.model.ShopPlanChangeReceiveModel>
     *@author: 徐一贺
     *@coddingDate: 2020/8/12 9:50
     *@version: v1.0
    **/
    List<ShopPlanChangeReceiveModel> planList(ShopPlanChangeReceiveModel param);
    /**
     *@name: getChangePlan
     *@description: 根据rppId获取变更数据
     *@param: [param]
     *@returnType: com.zhongwang.mms.module.buy.model.ShopPlanChangeReceiveModel
     *@author: 徐一贺
     *@coddingDate: 2020/8/12 20:02
     *@version: v1.0
     **/
    ShopPlanChangeReceiveModel getChangePlan(ShopPlanChangeReceiveModel param);

    /**
     *@name: getBReportPlanByRppId
     *@description: 根据主键获取提报计划
     *@param: [srcId]
     *@returnType: com.zhongwang.mms.module.buy.model.ShopPlanChangeReceiveModel
     *@author: 徐一贺
     *@coddingDate: 2020/8/13 12:43
     *@version: v1.0
    **/
    ShopPlanChangeReceiveModel getBReportPlanByRppId(Integer srcId);
    /**
     *@name: 根据计划ID获取该计划的变更信息
     *@description: TODO
     *@param: [rppResultId]
     *@returnType: com.zhongwang.mms.module.buy.model.ShopPlanChangeReceiveModel
     *@author: 徐一贺
     *@coddingDate: 2020/8/13 12:52
     *@version: v1.0
    **/
    ShopPlanChangeReceiveModel getChangePlanById(Integer rppResultId);
    /**
     *@name: updateByChaneg
     *@description: 更新变更信息
     *@param: [sourceModel]
     *@returnType: int
     *@author: 徐一贺
     *@coddingDate: 2020/8/13 13:21
     *@version: v1.0
    **/
    int updateByChange(ShopPlanChangeReceiveModel sourceModel);
    /**
     *@name: updateRecMarkByChange
     *@description: 回写状态
     *@param: [resultId]
     *@returnType: void
     *@author: 徐一贺
     *@coddingDate: 2020/8/13 13:31
     *@version: v1.0
    **/
    int updateRecMarkByChange(@Param("id") Integer resultId,@Param("recDate") Date recDate);

    /**
     *@name: getChildTotalNum
     *@description:  获取子级总数量
     *@param: [rppSrcId]
     *@returnType: Double 总数量
     *@author: 徐一贺
     *@coddingDate: 2020/8/14 20:02
     *@version: v1.0
    **/
    Double getChildTotalNum(Integer rppSrcId);
    /**
     *@name: getPdmRepResultByPrimaryKey
     *@description: 根据主键获取对应的B表计划实体
     *@param: [rppResultId] B表主键
     *@returnType: com.zhongwang.mms.module.buy.model.ShopPlanChangeReceiveModel
     *@author: 徐一贺
     *@coddingDate: 2020/8/15 8:30
     *@version: v1.0
    **/
    ShopPlanChangeReceiveModel getPdmRepResultByPrimaryKey(Integer rppResultId);
    /**
     *@name: getBReportPlanByRppResultId
     *@description: 依据B表主键获取C表实体类（原计划）
     *@param: [id] B表主键
     *@returnType: com.zhongwang.mms.gen.entity.BReportPlan
     *@author: 徐一贺
     *@coddingDate: 2020/9/2 11:55
     *@version: v1.0
    **/
    BReportPlan getBReportPlanByRppResultId(Integer id);
    /**
     *@name: getBReportPlanByRppResultId
     *@description: 依据B表主键获取C表实体类（原计划未删除）
     *@param: [id] B表主键
     *@returnType: com.zhongwang.mms.gen.entity.BReportPlan
     *@author: 徐一贺
     *@coddingDate: 2020年9月15日15:32:44
     *@version: v1.0
     **/
    BReportPlan getBReportPlanByRppResultIdAndIsNotRemove(Integer id);
    /**
     *@name: getReasonChangeList
     *@description: 获取变更原因
     *@param: []
     *@returnType: java.util.List<com.zhongwang.mms.gen.entity.VwDictCommon>
     *@author: 徐一贺
     *@coddingDate: 2020/9/2 12:47
     *@version: v1.0
     **/
    List<VwDictCommon> getReasonChangeList();
    /**
     *@name: getSheetInfoAndAuditInfo
     *@description: 获取变更单主单信息
     *@param: [id]
     *@returnType: com.zhongwang.mms.module.buy.model.ChangeDataModel
     *@author: 徐一贺
     *@coddingDate: 2020/9/2 15:36
     *@version: v1.0
     **/
    ChangeDataModel getSheetInfoAndAuditInfo(Integer id);
    /**
     *@name: getBeforeChangePlanById
     *@description: 获取变更前数据
     *@param: [id]
     *@returnType: java.util.List<com.zhongwang.mms.module.buy.model.ShopPlanChangeReceiveModel>
     *@author: 徐一贺
     *@coddingDate: 2020/9/2 16:01
     *@version: v1.0
    **/
    List<ShopPlanChangeReceiveModel> getBeforeChangePlanById(Integer id);
    /**
     *@name: getAfterChangePlanById
     *@description: 获取变后前数据
     *@param: [id]
     *@returnType: java.util.List<com.zhongwang.mms.module.buy.model.ShopPlanChangeReceiveModel>
     *@author: 徐一贺
     *@coddingDate: 2020/9/2 16:01
     *@version: v1.0
     **/
    List<ShopPlanChangeReceiveModel> getAfterChangePlanById(Integer id);


    /**
     *@name: updateRppNumByRppId
     *@description: 根据主键更新它的总数
     *@param: [rppSrcId 主键, childTotalNum 计划数量]
     *@returnType: void
     *@author: 徐一贺
     *@coddingDate: 2020/9/4 15:13
     *@version: v1.0
    **/
    int updateRppNumByRppId(@Param("rppId") Integer rppSrcId,@Param("rppNum") Double childTotalNum);

    /**
     *@name: updateVwPdmRepResultChangeMarkAndRecMarkAndChangeRecTime
     *@description: 把接收的变更的计划的状态和数据清空和反悔
     *@param: [id]
     *@returnType: void
     *@author: 徐一贺
     *@coddingDate: 2020/9/4 15:31
     *@version: v1.0
    **/
    void updateVwPdmRepResultChangeMarkAndRecMarkAndChangeRecTime(Integer id);

    /**
     *@name: getVwPdmRepResultByIdAndReceived
     *@description: 根据主键获取已接收的变更实体
     *@param: [id]
     *@returnType: com.zhongwang.mms.gen.entity.VwPdmRepResult
     *@author: 徐一贺
     *@coddingDate: 2020/9/4 15:37
     *@version: v1.0
    **/
    VwPdmRepResult getVwPdmRepResultByIdAndReceived(Integer id);

    /**
     * 获取物控员是不是计划接收与分配员类别员工
     * @param empName
     * @return
     */
    TEmploy getTEmployByNameAndType(String empName);

    /**********************************************
     * @title: insertBReportPlanChange
     * @description: 插入变更日志
     * @param:
     * @return:
     * @author: 徐一贺
     * @date: 2020/9/18 15:50
     * @versron: ver 1.0
     **********************************************
     */
    void insertBReportPlanChange(BReportPlanChange bReportPlanChange);

    /**  getUrlByRppResultId 根据B表ID获取变更后的Url
     * @param rppResultId
     * @return java.lang.String
     * @exception
     * @author 徐一贺
     * @date 2020/12/4 19:39
     */
    String getUrlByRppResultId(Integer rppResultId);
}
